#ifndef STATISTICS_H
#define	STATISTICS_H

#include "List.h"

#include <stdint.h>
#include <pthread.h>

typedef struct STATCycles{
    double Time;
    uint64_t CyclesElapsed;
} STATCycles;

typedef struct Statistics{
    uint32_t DBT_TotalBMCs;
    uint32_t DBT_EffectiveBMCs;
    uint32_t DBT_CompiledBlocks;
    uint32_t DBT_CompiledBytes;
    uint32_t DBT_CompiledInstructions;
    uint32_t DBT_OptimizedContexts;
    uint32_t DBT_BC_CoalescingOps;
    
    List     *CyclesElapsed;            //This list contains the amount of cycles
                                        //elapsed since emulation start
    pthread_t CycleTimerTID;
    uint32_t  CycleTimerDone;
    uint64_t  CycleTimerT0;
    
    pthread_mutex_t CycleTimerMutex;
    uint32_t CycleTimerCPUBusy;
} Statistics;

void InitStatistics(void);
void PrintStatistics(void);
STATCycles* STATCyclesNew(double Time, uint64_t CyclesElapsed);
void STATCyclesAdd(STATCycles* Cycles);
void InitCycleTimer();
void ShutdownCycleTimer();
void CycleTimerSetCPUBusy();
void CycleTimerClearCPUBusy();

#endif	/* STATISTICS_H */

